<!-- 文件所有权归北京优博泰克 -->
<template>
    <div class="home">
        <div class='box'>
            <div class="bgImg">
                <img src="@/assets/img/dfcv_bg.png" alt="" width="100%" height="100%">
            </div>
            <div class="logindiv">
                <transition name="loginBox">
                    <LoginBox @showTestBox="showTestBox" v-if="activeType == 1" ref="myLogin"></LoginBox>
                </transition>
                <transition name="loginBox">
                    <ForgetpwdBox @chageactive="chageactive" v-if="activeType == 2"></ForgetpwdBox>
                </transition>
                <transition name="loginBox">
                    <RetpwdBox @chageactive="chageactive" v-if="activeType == 3"></RetpwdBox>
                </transition>
            </div>
        </div>
        <div class="footbox">
            <div style="margin-left: 50px;">
                <img src="@/assets/img/logo.png" alt="">
                <p style="color:#475669;font-size:14px;">
                    技术支持： 东风设计研究院有限公司
                </p>
            </div>
        </div>
        <setting-box v-if="modalStatus == '后台地址设置弹窗'" ref="mysettingbox"></setting-box>
        <tsetLog v-if="modalStatus == '效验弹窗'" ref="mytestBox" />
    </div>
    <!-- 设置弹窗 -->
</template>
<script setup>
import LoginBox from "./loginBox.vue" //登陆栏
import ForgetpwdBox from "./forgetpwdBox.vue" //忘记密码
import RetpwdBox from "./retpwdBox.vue" //重置密码
import tsetLog from "./testLog.vue"
import { reactive, toRefs, computed, onMounted } from "vue"
import { useCach } from '@/store/cach'
import { useRoute, useRouter } from "vue-router"

onMounted(() => {
    openFunction()
})

const router = useRouter()
const route = useRoute()

let cachInfo = useCach()

let state = reactive({
    author: false,
    activeType: 1,
    code: ''
})
let { author, activeType, code } = toRefs(state)

let modalStatus = computed(() => cachInfo.modalStatus)

let openFunction = () => {
    if (JSON.stringify(route.query) != "{}" && route.query.resetCode) {
        state.activeType = 3
        state.code = route.query.resetCode
    }
}

let getUrlParam = (name) => {
    return decodeURIComponent((new RegExp('[&#63;|&]' + name + '=' + '([^&;]+&#63;)(&|#|;|$)').exec(location
        .href) || [, ""])[1].replace(/\+/g, '%20')) || null
}

//进入网络设置页面，将Vuex里面的active设置为2
let joinSetting = () => {
    state.activeType = 2
}

//进入登录页面，将Vuex里面的active设置为1
let joinLogin = () => {
    state.activeType = 1
}

let chageactive = (v) => {
    state.activeType = v
}

//显示配置弹窗
let showsettingbox = () => {
    state.$store.commit('changeModalStatus', '后台地址设置弹窗')
    state.$store.commit('showModal', true)
}

//显示效验弹窗
let showTestBox = () => {
    state.$store.commit('changeModalStatus', '效验弹窗')
    state.$store.commit('showModal', true)
}
</script>
<style scoped>
.home {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.box {
    width: 100vw;
    height: 88vh;
}

.footbox {
    height: 12vh;
    width: 100vw;
    /* position: absolute; */
    /* bottom: 0; */
    display: flex;
    align-items: center;
    background: #ffffff;
    /*padding: 20px 0 10px 50px;*/
}

.footbox img {
    /* height: 40px;
      margin-top: 20px;
      margin-left: 50px; */
}

.bgImg {
    /* width: 1920px; */
    /* height: -webkit-calc(100% - 100px); */
    /* position: absolute; */
    /* background-size: 100%; */
    /* min-width: 500px; */
    /* background-repeat: no-repeat; */
    height: 100%;
    width: 100%;
    /* background-size: cover; */
    /* background-image: url(../../static/img/png/dfcv_bg.png); */
}

.loginBox {
    z-index: 1;
    width: 400px;
    height: 340px;
    background: rgba(255, 255, 255, 1);
    box-shadow: 2px 4px 8px 0px rgba(0, 0, 0, 0.5);
    padding: 30px 20px;
}

.bgImg2 {
    height: 88%;
}

.titbox {
    position: absolute;
    top: 40px;
    left: 40px;
    color: #ffffff;
}

p {
    margin: 0;
    padding: 0;
    font-size: 30px;
}

.titbox p:nth-child(2) {
    font-size: 46px;
}

.settingBox {
    width: 520px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 2px 4px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    /*justify-content: center;*/
    flex-direction: column;
    align-items: center;
}

.companyCopyright {
    position: fixed;
    bottom: 300px;
    color: #ffffff;
    width: 400px;
    font-size: 14px;
    margin-top: 20px;
}

.loginBox-enter-activeType {
    transition: all 0.3s ease 0.3s;
}

.loginBox-leave-activeType {
    transition: all 0.3s cubic-bezier(1, 2, 1.2, 1);
    animation: reverse;
}

.loginBox-enter,
.loginBox-leave-to
/* .slide-fade-leave-activeType for below version 2.1.8 */

    {
    transform: translateX(200px);
    opacity: 0;
}

.logindiv {
    position: absolute;
    right: 170px;
    top: 20%;
}


@keyframes loginBox-in {
    0% {
        opacity: 0%;
    }

    10% {
        opacity: 10%;
    }

    20% {
        opacity: 20%;
    }

    50% {
        opacity: 50%;
    }

    100% {
        opacity: 100%;
    }
}
</style>